import MySQLdb
import MySQLdb.cursors


class MysqlUtil(object):
    def __init__(self):
        self.conn = MySQLdb.connect('127.0.0.1', 'root', 'wh970121', 'python', charset="utf8mb4", use_unicode=True)
        self.cursor = self.conn.cursor()

    def execute_with_param(self, sql, params):
        self.cursor.execute(sql, params)
        self.conn.commit()
    def delete_sql(self,sql):
        self.cursor.execute(sql)
        self.conn.commit()

    def execute_without_param(self, sql):
        self.cursor.execute(sql)
        nRet = self.cursor.fetchone()
        self.conn.commit()
        return nRet
